home *** CD-ROM | disk | FTP | other *** search
- <!--
- LDAP (com.dartware.tcp.ldap)
- Copyright © 2000 Dartware, LLC. All rights reserved.
- -->
-
- <header>
- type = "tcp-script"
- package = "com.dartware"
- probe_name = "tcp.ldap"
- human_name = "LDAP"
- version = "1.1"
- address_type = "IP"
- port_number = "389"
-
- old_protocol = "8" # Backward compat. with old numbering scheme.
- old_script = "8201"
-
- </header>
-
- <description>
-
- ≤GB≥Lightweight Directory Access Protocol (LDAP)≤P≥
-
- The protocol used to access directories supporting the X.500 models, as described in RFC 2251.
-
- </description>
-
- <parameters>
-
- "Bind Name" = "o=Dartmouth College,c=US"
- "Name to Lookup" = "Bill Fisher"
-
- </parameters>
-
- <script>
-
- CONN #60 (connect timeout in seconds)
- WAIT #30 @IDLE (idle timeout in seconds)
- DISC @DISCONNECT (disconnect handler)
- LINE BER
-
- -- All LDAP messages have the following structure envelope:
- --
- -- LDAPMessage ::= SEQUENCE {
- -- messageID INTEGER( 0..2^31-1),
- -- protocolOp CHOICE {
- -- bindRequest BindRequest,
- -- bindResponse BindResponse,
- -- unbindRequest UnbindRequest,
- -- searchRequest SearchRequest,
- -- searchResEntry SearchResultEntry,
- -- searchResDone SearchResultDone,
- -- searchResRef SearchResultReference,
- -- ...
- -- }
- -- controls [0] Controls OPTIONAL
- -- }
- --
- -- This script never includes the optional controls field in its LDAP messages.
-
-
- -- Send bindRequest PDU and expect a bindResponse PDU answer:
- --
- -- BindRequest ::= [APPLICATION 0] SEQUENCE {
- -- version INTEGER (1 .. 127),
- -- name OCTET STRING,
- -- authentication [PRIVATE 0] OCTET STRING
- -- }
- --
-
- BSND { #1, [60]{ #3, "${Bind Name}", [80]""} }
- BRCV { #1, [61]{ [0A]#ENUM, "", "" } } else @PARSE_ERROR
- NBNE #${ENUM} #0 @CHECK_VERSION
-
- -- Send a searchRequest
- @SEND_SEARCH:
- BSND { #2, [63]{ "${Bind Name}", [0A]#2, [0A]#3, #0, #60, [01]#0, [A3]{ "cn", "${Name to Lookup}"}, {} }}
-
- STOR "COUNT" "0"
- @PARSE_REPLY:
- BRCV { #2, ["TAG"]{ ... } } else @PARSE_ERROR
- NBNE #${TAG} #100 else @NOT_RES_ENTRY
- BRCV { #2, [64]{ "C", { {"X",[31]{ "Y" }},... } } } else @PARSE_ERROR
- NADD "COUNT" #1
- NEXT
- GOTO @PARSE_REPLY
-
- @NOT_RES_ENTRY:
- NBNE #${TAG} #101 @NOT_RES_END
- DONE OKAY "[LDAP] Found ${COUNT} matches for \"${Name to Lookup}\""
-
- @NOT_RES_END:
- DONE ALRM "[LDAP] Unexpected response: ${TAG}"
-
-
- -- Error Handlers --
-
- @CHECK_VERSION:
- NBNE #${ENUM} #2 else @BAD_BIND_RESPONSE
- BSND { #1, [60]{ #2, "${Bind Name}", [80]""} }
- BRCV { #1, [61]{ [0A]#ENUM, "", "" } } else @PARSE_ERROR
- NBNE #${ENUM} #0 @BAD_BIND_RESPONSE
- GOTO @SEND_SEARCH
-
- @BAD_BIND_RESPONSE:
- NBNE #${ENUM} #1 else @+2
- DONE WARN "[LDAP] Response to Bind Request = operationsError (1)"
- NBNE #${ENUM} #2 else @+2
- DONE WARN "[LDAP] Response to Bind Request = protocolError (2)"
- NBNE #${ENUM} #48 else @+2
- DONE WARN "[LDAP] Response to Bind Request = inappropriateAuthentication (48)"
- NBNE #${ENUM} #49 else @+2
- DONE WARN "[LDAP] Response to Bind Request = invalidCredentials (49)"
- DONE WARN "[LDAP] Response to Bind Request = ${ENUM}"
-
- @PARSE_ERROR:
- DONE ALRM "[LDAP] Error parsing response from the server. [Line ${_IDLELINE}]"
-
- @IDLE:
- DONE ALRM "[LDAP] No data for ${_IDLETIMEOUT} seconds. [Line ${_IDLELINE}]"
-
- @DISCONNECT:
- DONE DOWN "[LDAP] Disconnected from port ${_REMOTEPORT} after ${_SECSCONNECTED} seconds."
-
- </script>
-